package org.xiaolicode.learn.rabbitmq.producer.controller;

import jakarta.annotation.Resource;
import org.springframework.amqp.rabbit.core.RabbitTemplate;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.xiaolicode.learn.rabbitmq.producer.enums.RoutingKeyEnum;

/**
 * @author 小李Code
 */
@Controller
@RequestMapping("/test")
public class Producer01 {
    @Resource
    private RabbitTemplate rabbitTemplate;

    @GetMapping("/{msg}")
    public void send(@PathVariable String msg) {
        rabbitTemplate.convertAndSend(RoutingKeyEnum.TEST.getValue(), msg);
    }
}
